<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>栏目管理</title>
<link rel="stylesheet" type="text/css" href="template/admin.css"/>
<script type="text/javascript" src="template/images/jquery.js"></script>
<script type="text/javascript">
function show_list(n){
$(n).parent().parent('#border').parent('#catagory').find('#catagory').toggle();
}
$(document).ready(function(){
	//ajax修改排序
	$('.table_info1').find('#order_num').click(function(){
		$has_input=$(this).find('input').size();
		if(!$has_input){	
		var $order=$(this).find('span').html();
		$id=$(this).find('span').attr('id');
		
		$(this).empty();	
		$('<input id="'+$id+'" style="width:30px;padding:0;height:18px;" value="'+$order+'"/>').bind("blur",function(){
			if(!/^[0-9]+$/.test($(this).val())){
				alert("只能是数字");
				return;
			}
			var $rel=$(this).parent().attr('rel');
			var $action='';
			if($rel=='order'){
				$action='ajax_order';
			}else if($rel=='tpl'){
				$action='ajax_tpl';
			}
			//$(this).load('admin_catagory.php',{'action':$action,'lang':'<?php echo $lang;?>','order_id':$(this).val(),'id':$(this).attr('id')},function(msg){
				
			//});
			$.ajax({
				type:'POST',
				url:'admin_catagory.php',
				data:'action='+$action+'&lang=<?php echo $lang;?>&order_id='+$(this).val()+'&id='+$(this).attr('id'),
				success:function(msg){
					if(msg==1){alert('已经存在该模板标示');}
				}
			});
			$('<span id="'+$(this).attr('id')+'">'+$(this).val()+'</span>').appendTo($(this).parent());
			$(this).remove();
		}).appendTo($(this));
		}
	}).hover(function(){
		$(this).addClass('on_order');
	},function(){
		$(this).removeClass('on_order');
	});
});
</script>
<?php
	$tech_num = (count($tech_arr)-1);
	$show_tech = $tech_arr[rand(0,$tech_num)];
?>
<!--
<script type="text/javascript">

	$(document).ready(function(){
		$str = '<?php echo $show_tech;?>';
		$('#show_tech').html("<em>小提示：</em>"+$str).fadeIn('slow');
	});

</script>
-->
</head>

<body>
<div class="admin_position"><span>当前位置 > 栏目管理</span><p id="show_tech" style="display:none"></p></div><!--位置-->
<div class="div_out">
 		<div class="lang">
			<ul>
			 <?php
 $cache_file=DATA_PATH."cache/lang_cache.php";
 $cache_arr=read_cache($cache_file,'lang_cache');
 if(!empty($cache_arr)){
 foreach($cache_arr as $k=>$v){
  if(!$v['lang_is_use']){continue;}
 ?>
 <li><a href="?lang=<?php echo $v['lang_tag'];?>" class="<?php if($GLOBALS['lang']==$v['lang_tag']){echo 'hover';}?>"><?php echo $v['lang_name'];?></a></li>
 <?php
 }
 }
 ?>
			</ul>
		</div><!--语言-->
		
<div class="order_contain">
<form name="maininfo" method="post" enctype="multipart/form-data" class="form">
<div class="order_main">
 <table cellpadding="0" cellspacing="0" width="100%" class="table_info1">
 	<thead>
		<tr><th style="text-align:left; padding-left:5px; font-weight:normal">请先添加顶级栏目,如果已经添加了栏目没显示请更新下栏目缓存<!--<span style="padding-left:30px;"><a href="<?php echo '../template/'.$_confing['web_template'].'/tpl_info.gif';?>" target="_blank" style="font-weight:bold; color:#FF0000">查看网站配置说明</a></span>--></th></tr>
	</thead>
	<tbody>

		<tr>
		<td style="border-bottom:none">
		<?php
		if(!empty($cate_list)){
		foreach($cate_list as $key=>$value){
			if($value['cate_parent']==0){
			$is_gd=($value['cate_tpl']==1)?'&nbsp;<span style="color:red">引导栏目</span>':'';
			$channel_info=get_cate_info($value['cate_channel'],$channel);//获得内容模型信息
			$list_php = empty($channel_info['list_php'])?'show_list.php':$channel_info['list_php'];
			$list_php = ($value['cate_channel']=='-9')?'order/order.php':$list_php;
			$is_cate_type = '';
			if($value['cate_channel']==1){
				$is_cate_type = '[<font style="color:red">单页</font>]';
			}elseif($value['cate_channel']=='-9'){
				$is_cate_type = '[<font style="color:#0000FF">表单</font>]';
			}
		?>
			<div id="catagory">
			<div id="border" style="border-bottom:1px dashed #ccc; padding:2px 0; height:25px; line-height:25px; ">
				<div class="left" id="show" style="cursor:pointer"><span class="exp" onclick="show_list(this);">&nbsp;</span><span class="cata">
				<?php echo "<a href=\"".CMS_SELF.$list_php."?id={$value['id']}\" target=\"_blank\">{$is_cate_type}{$value['cate_name']}</a>(<span style=\"color:#999\">排序</span><em rel=\"order\" style=\"font-style:normal; padding:0 8px;\" id=\"order_num\"><span id=\"{$value['id']}\">{$value['cate_order']}</span></em>&nbsp;<span style=\"color:#999\">栏目id</span>:{$value['id']}&nbsp;<span style=\"color:#999\">模板标示ID:</span><em style=\"font-style:normal; padding:0 8px;\" rel=\"tpl\" id=\"order_num\"><span id=\"{$value['id']}\">{$value['temp_id']}</span></em>{$is_gd})";
				$cate_nav=empty($value['cate_nav'])?array(''):explode(',',$value['cate_nav']);
				echo in_array('2',$cate_nav)?"<span style=\"color:#3366FF\">导航中部显示</span>":"";
				echo in_array('3',$cate_nav)?"<span style=\"color:#FFCC66\">导航底部显示</span>":"";

				if($value['cate_hide']){
					echo "<span style=\"color:red; padding:0 3px;\">隐藏</span>";
				}
				$href2=($value['cate_channel']==1)?"href=\"admin_content_alone.php?action=content_list\"":"href=\"admin_content.php?action=content_list&id={$value['cate_channel']}&cate={$value['id']}&lang={$value['lang']}\"";
				?></span></div><div class="right"><span class="caozuo"><a href="?action=child&parent=<?php echo $value['id'];?>&channel_id=<?php echo $value['cate_channel'];?>&lang=<?php echo $GLOBALS['lang']?>">增加下级栏目</a>|<a href="?action=xg&lang=<?php echo $GLOBALS['lang'];?>&id=<?php echo $value['id'];?>&parent=<?php echo $GLOBALS['parent'];?>">修改栏目</a>|<a href="?action=move_cate&cate=<?php echo $value['id'];?>&lang=<?php echo $lang;?>">移动栏目</a>|<a href="javascript:if(confirm('确定要删除么,删除后不可恢复!')){location.href='admin_catagory.php?action=del&lang=<?php echo $GLOBALS['lang'];?>&id=<?php echo $value['id'];?>&parent=<?php echo $GLOBALS['parent'];?>';}  ">删除栏目</a></span></div>
				<div style="clear:both"></div>
				</div>
				<?php
				$parent_id=$value['id'];
			unset($cate_list[$key]);
			get_cate_list($cate_list,$parent_id,$value['haschild']);
				?>
				
			</div>
			
			<?php
			}
			}
			 }?>
			
		</td>
		</tr>	

	</tbody>
 </table>
 </div>
<input type="hidden" name="action" value="add_inc"/><input type="hidden" name="lang" value="<?php echo $lang;?>"/>
 </form>
 </div> <!--内容切换-->


</body>
</html>
